<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<script>
	$(function() {
		$('#memberMgt_cardMgt_datagrid').datagrid({
			url : 'cardAction!getDatagrid.action',
			fitColumns : false,
			border : false,
			pagination : true,
			pageSize : 20,
			fit : true,
			singleSelect : true,
			rownumbers : true,
			idField : 'pkCard',
			//sortName : 'name',
			columns : [ [ {
				field : 'pkCard',
				title : '会员卡编号',
				width : 150,
				//hidden : true,
				align : 'center'
			}, {
				field : 'pkMember',
				title : '会员姓名',
				width : 150,
				sortable : true,
				align : 'center',
			}, {
				field : 'memberName',
				title : '会员编号',
				width : 150,
				sortable : true,
				align : 'center'
			}, {
				field : 'pkStuff',
				title : '员工姓名',
				width : 150,
				sortable : true,
				align : 'center'
			}, {
				field : 'stuffName',
				title : '员工编号',
				width : 150,
				sortable : true,
				align : 'center'
			}, {
				field : 'cardType',
				title : '会员卡类型',
				width : 150,
				sortable : true,
				align : 'center'
			}, {
				field : 'beginDate',
				title : '会员卡开始日期',
				width : 150,
				sortable : true,
				align : 'center'
			}, {
				field : 'endDate',
				title : '会员卡结束日期',
				width : 150,
				sortable : true,
				align : 'center'
			},  {
				field : 'cdatetime',
				title : '创建时间',
				width : 150,
				sortable : true,
				align : 'center'
			}] ],

			toolbar : [ {
				iconCls : 'icon-search',
				text : '查询',
				handler : function() {
					$('#memberMgt_cardMgt_searchDialog').dialog('open');
				}
			}, '-', {
				iconCls : 'icon-add',
				text : '增加',
				handler : function() {
					$('#memberMgt_cardMgt_addForm').form('clear');
					$('#memberMgt_cardMgt_addDialog').dialog('open');
				}
			}, ],
		});

		$('#memberMgt_cardMgt_addForm').form({
			url : 'cardAction!add.action',
			success : function(r) {
				var obj = jQuery.parseJSON(r);
				if (obj.success) {
					$('#memberMgt_cardMgt_addDialog').dialog('close');
					$('#memberMgt_cardMgt_datagrid').datagrid('load');
				}
				$.messager.alert({
					title : '提示',
					msg : obj.msg
				});
			}
		});

	
	});

	function cardSearchFun() {
		$('#memberMgt_cardMgt_datagrid').datagrid('load', serializeObject($('#memberMgt_cardMgt_searchForm')));
	};
	function cardClearFun() {
		$('#memberMgt_cardMgt_searchForm').form('clear');
		$('#memberMgt_cardMgt_datagrid').datagrid('load', {});
	};
</script>

<div class="easyui-panel" data-options="border:false,fit:true">
	<div id="memberMgt_cardMgt_datagrid_panel" class="easyui-panel" data-options="border:false,fit:true,">
		<table id="memberMgt_cardMgt_datagrid"></table>
	</div>
</div>

<div id="memberMgt_cardMgt_addDialog" class="easyui-dialog" style="width: 650px; height: 400px" data-options="iconCls:'icon-add',
		closed:true,
		minimizable:false,
		maximizable:false,
		draggable:false,
		title:' 增加',
		modal:true,
		buttons: [{text:'取消',
					iconCls:'icon-cancel',
					handler:function(){
						$('#memberMgt_cardMgt_addDialog').dialog('close');
					}
				},{text:'增加',
					iconCls:'icon-add',
					handler:function(){
						$('#memberMgt_cardMgt_addForm').submit();
					}
				}]
				">
	<form id="memberMgt_cardMgt_addForm" style="margin: 3%">
		<table style="margin-top: 15px;border-collapse: separate; border-spacing: 15px; width: 580px;">
			<label>基本信息</label>
			<hr style="height: 1px; border: none; border-top: 1px solid #D8E6E7;" />
			<tr>
				<td>会员卡编号</td>
				<td><input class="easyui-textbox" type="text" pkTraining="pkCard" data-options="readonly:true"></input></td>
				<td>员工</td>
				<td><input class="easyui-combobox" type="text" name="pkStuff" panelHeight="120px" data-options="required:true,
				valueField:'pkStuff',
				textField:'name',
				editable:false,
				url:'stuffAction!getComboBox.action'"></input></td>
			</tr>
			<tr>
				<td>会员名</td>
				<td><input class="easyui-combobox" type="text" name="pkMember" panelHeight="120px" data-options="required:true,
				valueField:'pkMember',
				textField:'name',
				editable:false,
				url:'memberAction!getComboBox.action'"></input></td>
			</tr>
			<tr>
				<td>会员卡类型</td>
				<td><select class="easyui-combobox" type="text" name="cardType" data-options="required:true,editable:false,panelHeight:70" style="width:70px;">
						<option value="月卡">月卡</option>
						<option value="季卡">季卡</option>
						<option value="半年卡">半年卡</option>
						<option value="一年卡">一年卡</option>
						<option value="两年卡">两年卡</option>
				</select></td>
			</tr>
			<tr>
				<td>会员卡开始日期</td>
				<td><input class="easyui-datebox" type="text" name="beginDate" data-options=""></input></td>
				<td>会员卡结束日期</td>
				<td><input class="easyui-datebox" type="text" name="endDate" data-options=""></input></td>
			</tr>
		</table>
		<table cellpadding="10" style="margin-top: 15px;border-collapse: separate; border-spacing: 15px; width: 580px;">
			<label>操作信息</label>
			<hr s style="height: 1px; border: none; border-top: 1px solid #D8E6E7;" />
			<tr>
				<td>创建时间</td>
				<td><input class="easyui-textbox" type="text" name="cdatetime" data-options="readonly:true"></input></td>
			</tr>
		</table>
	</form>
</div>

<div id="memberMgt_cardMgt_searchDialog" class="easyui-dialog" title="查询" style="width: 600px; height: 300px" data-options="iconCls:'icon-search',modal:true,closed:true,collapsible:false,minimizable:false,maximizable:false,
		buttons: [{text:'重置查询结果',
					iconCls:'icon-reload',
					handler:function(){
						cardClearFun();
						$('#memberMgt_cardMgt_searchDialog').dialog('close');
					}
				},
		{text:'重置查询条件',
					iconCls:'icon-redo',
					handler:function(){
						$('#memberMgt_cardMgt_searchForm').form('clear');
					}
				},{text:'查询',
					iconCls:'icon-search',
					handler:function(){	
						cardSearchFun();
						$('#memberMgt_cardMgt_searchDialog').dialog('close');
					}
				}]">

	<form id="memberMgt_cardMgt_searchForm" style="margin: 5%">
		<table cellpadding="10" style="margin-top: 15px;border-collapse: separate; border-spacing: 15px; width: 450px;">
			<tr>
				<td>教练姓名</td>
				<td><input class="easyui-textbox" type="text" name="name" data-options=""></input></td>
				<td>性别</td>
				<td><select class="easyui-combobox" type="text" name="gender" data-options="required:true,editable:false,panelHeight:70" style="width: 70px;">
						<option value="男">男</option>
						<option value="女">女</option>
				</select></td>
			</tr>
			<!--  <tr>
				<td>教练编号</td>
				<td><input class="easyui-textbox" type="text" name="pkcard" data-options=""></input></td>
			</tr>-->

		</table>
	</form>
</div>
</table>